package com.flaremars.picker.utils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * Created by FlareMars on 2016/2/26.
 */
public enum StringUtils {
    INSTANCE;

    public String str2UrlUTF8(String src) {
        try {
            return URLEncoder.encode(src, "utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return "";
    }

    public boolean isEmpty(String input) {
        if (input == null || "".equals(input))
            return true;

        for (int i = 0; i < input.length(); i++) {
            char c = input.charAt(i);
            if (c != ' ' && c != '\t' && c != '\r' && c != '\n') {
                return false;
            }
        }
        return true;
    }
}
